package integration;

import java.io.IOException;
import java.net.MalformedURLException;

import org.junit.Assert;
import org.junit.Test;

import com.gargoylesoftware.htmlunit.FailingHttpStatusCodeException;
import com.gargoylesoftware.htmlunit.WebClient;
import com.gargoylesoftware.htmlunit.html.HtmlPage;

/**
 * Testklasse ist mit IT (IntegrationTest)-Suffix zu benamen fuer das Failsafe-Plugin.
 * 
 * @author joerg
 *
 */
public class StartupIT {
	
	@Test
	public void testStartup() throws FailingHttpStatusCodeException, MalformedURLException, IOException{
	    final WebClient webClient = new WebClient();
	    webClient.setJavaScriptEnabled(false);
	    final HtmlPage page = (HtmlPage)webClient.getPage("http://localhost:8080/cas");
	    Assert.assertNotNull(page);
	    System.out.println(page.getTitleText());
//	    Assert.assertEquals("HtmlUnit - Welcome to HtmlUnit", page.getTitleText());
//
//	    final String pageAsXml = page.asXml();
//	    Assert.assertTrue(pageAsXml.contains("<body class=\"composite\">"));
//
//	    final String pageAsText = page.asText();
//	    Assert.assertTrue(pageAsText.contains("Support for the HTTP and HTTPS protocols"));

//	    webClient.
	}

}
